<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script type="text/javascript"src="https://api.map.baidu.com/api?v=3.0&type=webgl&ak=cmBFfyg6SEGGcyPUPRASTNFzuhvfjuGq"></script>
  <title>百度地图获取经纬度</title>
</head>
<body>
  <script>
    let that = this;
      var geolocation = new BMapGL.Geolocation();
      // 开启SDK辅助定位
      geolocation.enableSDKLocation();
      geolocation.getCurrentPosition(function(res) {
        console.log(res, "获取定位");
        if (res.accuracy == null) {
          that.load = false;
          console.log("定位失败,请开启定位!");
          //用户拒绝地理位置授权
          return;
        }
      });
  </script>
</body>
</html>